// -*- go -*-
//

package main

import (
	"crypto/rsa"
)

// d: 0x321af139
// n: 0xd60b2b09
// e: 0x10001
//
// private: d, e
// public:  n, e

// msg: 0x6d7472
// cipher: 0x61f9ef88

// $ ./garbled -e -v -i 9 examples/rsa.mpcl
// $ ./garbled -v -i 0x6d7472,0x321af130,0xd60b2b09,0x10001 examples/rsa.mpcl

type Size = uint32

type Garbler struct {
	msg       Size
	privShare Size
	pubN      Size
	pubE      Size
}

func main(g Garbler, privShare Size) (uint, uint) {

	priv := g.privShare + privShare

	cipher := rsa.Encrypt(g.msg, g.pubE, g.pubN)
	plain := rsa.Decrypt(cipher, priv, g.pubN)

	return cipher, plain
}
